<div id="content_single">
	<h1 class="post_h1"><?php echo $post->post_title;?></h1>
  <div class="p-meta">Đăng Bởi 
    <span class="vcard author">
      <span class="fn">
        <a rel="author" title="Đăng bởi Một Thế Giới" href="#">Một Thế Giới</a>
      </span>
    </span>
    <span class="updated meta-button"><?php echo @my_date_format($post->post_time_start); ?></span>
  </div>
  <div class="post-meta">
    <h2><?php echo @$post->post_excerpt; ?></h2>
    <?php echo Modules::load_widgets($layout_id,'left2');?>
    <?php if(isset($post_relate)):?>
    <div class="post-ctbqt">
      <p><strong>Có thể bạn quan tâm</strong></p>
      <ul>
      <?php foreach ($post_relate as $p) : ?>
        <li>
        	<a title="<?php echo $post->post_title;?>" href="<?php echo post_url($p);?>">» 
        		<?php echo $p->post_title;?>
        	</a>
        </li>
      <?php endforeach;?>
      </ul>
    </div>
    <?php endif;?>

    <?php

      if($post->post_show_type == 1){//Neu la tin anh
        $post->post_content_image = maybe_unserialize($post->post_content_image);
        if(isset($post->post_content_image)):
        ?>
          <ul class="bxslider">
        <?php foreach ($post->post_content_image as $slide): ?>
            <li>
              <img src="<?php echo $slide['fullPath'] ;?>?crop=auto&scale=both" title="<?php echo $slide['caption'];?>" />
            </li>
        <?php endforeach;?>
          </ul>
            <script type="text/javascript">
              $('.bxslider').bxSlider({
                mode: 'fade',
                captions: true
              });
            </script>
        <?php endif;?>
    <?php }
    else { ?>
      <?php echo $post->post_content;?>
    <?php };?>

</div>
  <?php echo Modules::load_widgets($layout_id,'left4');?>
  <div class="post_meta_at">
    <?php if($tags):?>
    <div class="post_meta_at tag"> <span><strong>Tags : </strong></span>
      <ul>
      <?php foreach ($tags as $t):?>
        <li><a title="có dấu" href="#"><?php echo $t->term_name;?></a></li>
      <?php endforeach;?>
      </ul>
    </div>
	 <?php endif;?>	
    <div class="post_meta_at author">
      <p><strong>Khương Tử Nha</strong></p>
    </div>
  </div>
  <div class="cls"></div>
   <?php if($post_others):?>
  <div class="post_meta_tlq">
    <div class="post-title">
      <h3><span>Tin Liên Quan</span></h3>
    </div>
    <ul>
    	<?php foreach ($post_others as $p) :?>
      	<li>
      		<a title="<?php echo $p->post_title;?>" href="<?php echo post_url($p);?>">» <?php echo $p->post_title;?></a>
      	</li>
      <?php endforeach;?>
    </ul>
  </div>
	 <?php endif;?>
</div>
  <?php echo Modules::load_widgets($layout_id,'left5');?>
  <div class="post_meta_share">
    <div class="post_meta_share_left">
      <div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
    </div>
    <div class="post_meta_share_right">
      <div class="post_meta_note"><img alt="khong dau" src="<?php echo theme_url('imgs/print.png');?>"/>
        <p>In</p>
      </div>
      <div class="post_meta_note"><img alt="khong dau" width="15" src="<?php echo theme_url('imgs/comment_icon.gif');?>"/>
        <p>Xem phản hồi</p>
      </div>
      <div class="post_meta_note"><img src="<?php echo theme_url('imgs/comment_icon.gif');?>" alt="khong dau" width="15"/>
        <p>Gửi phản hồi</p>
      </div>
    </div>
    <div class="cls"></div>
  </div>

  <!-- COMMENT BOX REQUEST -->
  <div id="comments-toggle-bar">
    <a href="javascript:void(0);" id="comment-toggle-button">
      <img src="<?php echo theme_url('imgs/comment.png');?>" align="absmiddle" alt="Bình luận">&nbsp;&nbsp;<span id="comment-toggle-text">Xem và gửi phản hồi tại đây</span> </a>
  </div>
  <!-- END COMMENT BOX REQUEST -->
  <script type="text/javascript">
  jQuery('#comment-toggle-button').click(function(e) {
    e.preventDefault();
    if (jQuery('#commentbox').is(":hidden")) {
      jQuery('#commentbox').show();
      jQuery('#comment-toggle-text').html("Ẩn phần phản hồi");
    } else {
      jQuery('#commentbox').hide();
      jQuery('#comment-toggle-text').html("Xem và gửi phản hồi tại đây");
    }
  });
  </script>
  <div id="commentbox" style="display: none;" >
    <div id="ctl00_mainContent_CommentBox1_divCommentList" class="comments-list">
      <ul>
        <?php if(isset($comments) && $comments) :
              foreach ($comments as $c) :
        ?>
          <li>
            <div class="p-title"><?php echo $c->comment_author ;?></div>
            <div class="p-time"><?php echo date ( 'h:i - d/m/Y' , $c->comment_date);?></div>
            <div class="p-content"><p></p><p><?php echo $c->comment_content ;?></p><p></p></div>
          </li>
        <?php 
        endforeach;
        endif;?>
      </ul>
      <nav id="comments-nav"><div class="comments-previous"></div><div class="comments-next"></div></nav>
    </div>
    <div class="comments">
      <h3 class="comment-reply-title" id="reply-title">Gửi phản hồi </h3>
      <form id="postcomment_frm" method="post" action="#">
        <div class="comment-form" id="commentform">
          <p class="comment-notes">Email của bạn sẽ không hiển thị công khai. Các trường bắt buộc được đánh dấu <span class="required">*</span></p>
          <p class="comment-form-author">
            <input type="text" aria-required="true" value="" name="edit[comment_author]" placeholder="Họ và tên" id="hoten">
          </p>
          <p class="comment-form-email">
            <input type="text" aria-required="true" value="" name="edit[comment_author_email]" placeholder="Email" id="email">
          </p>
          <div style="text-align:left;" id="divverifier">
            <p class="comment-form-captcha">
              <input type="text" required aria-required="true"  value="" title="Nhập mã Captcha" placeholder="Nhập mã Captcha" id="capcha" name="captcha_word">
            </p>
            <div class="comment-captcha"> 
              <div id="cap-img" style="display: -webkit-inline-box"><?php echo $captcha;?></div>
              <img alt="khong dau" src="<?php echo theme_url('imgs/refesh.gif');?>" width="23" height="23" class="refesh_icon" style="cursor:pointer;">
            </div>
          </div>
          <div class="cls"></div>
          <p class="comment-form-comment"><textarea aria-required="true" rows="8" name="edit[comment_content]" id="comments"></textarea></p>
          <input type="hidden" name="edit[comment_post_ID]" value="<?php echo $post->post_id;?>" />
          <p class="form-submit"><input type="submit" value="Phản hồi" id="submit" ></p>
        </div>
      </form>
    </div>
  </div>

  <div class="post_meta_comment">
  	<div id="fb-root"></div>
    <style type="text/css">
      label.error {
        font-style: italic;
        color: red;
        position: relate;
      }
    </style>
    <script type="text/javascript">
      jQuery(function(){
        jQuery(".refesh_icon").click(function(){
          $.post( "<?php echo base_url();?>captcha-refresh.html")
          .done(function( data ) {
            if(data!='')
              $('#cap-img').html($(data));
          });
        });

        $("#postcomment_frm").validate({
          submitHandler: function(form) {
            $.post( "<?php echo base_url();?>dang-phan-hoi-bai-viet.html", $("#postcomment_frm").serializeArray())
            .done(function( data ) {
              if(data=='1'){
                alert("Cảm ơn bạn đã đóng góp ý kiến về bài viết ! ");
              }
              else if(data=='0'){
                alert("Xảy ra lỗi trong quá trình phản hồi , vui lòng gửi lại ! ");
              }
              else{
                alert("Mã xác nhận không chính xác ! ");
              }

              $.post( "<?php echo base_url();?>captcha-refresh.html")
                .done(function( data ) {
                  if(data!='')
                    $('#cap-img').html($(data));
              });
            });
            return false;
          },
          invalidHandler: 
          function(event, validator) {
            var message = '';
            $.each(validator.errorList,function(index,element){
              message = element.message + "\n";
            });
            alert(message);
          },
          rules:{
            'edit[comment_author]' : {required:true} ,
            'edit[comment_author_email]':{
              required: true,
              email: true
            },
            'edit[comment_content]': {required : true },
          },
          messages:{
            'edit[comment_author]' : {
              required : "Vui lòng nhập tên !",
              
            },
            'edit[comment_author_email]':{
              required : "Vui lòng nhập địa chỉ email !",
              email : "Email không hợp lệ !"
            },
            'edit[comment_content]':{
              required : "Vui lòng nhập nội dung bình luận !"
            }
          },
        });
      });
    </script>
  	<script>(function(d, s, id) {
    	var js, fjs = d.getElementsByTagName(s)[0];
    	if (d.getElementById(id)) return;
    	js = d.createElement(s); js.id = id;
    	js.src = "http://connect.facebook.net/vi_VN/sdk.js#xfbml=1&version=v2.0";
    	fjs.parentNode.insertBefore(js, fjs);
    	}(document, 'script', 'facebook-jssdk'));
    </script>
  	<div class="fb-comments" data-href="http://motthegioi.vn" data-numposts="5" data-width="100%" data-colorscheme="light"></div>
  </div>
  
